﻿using PLCS.Domain.Configs;
using PLCS.Domain.Equipments;
using PLCS.Domain.ErrorLibraries;
using PLCS.Domain.Logs;
using PLCS.Domain.Menus;
using PLCS.Domain.Orders;
using PLCS.Domain.PLCConfigs;
using PLCS.Domain.Processes;
using PLCS.Domain.Roles;
using PLCS.Domain.Solutions;
using PLCS.Domain.Stations;
using PLCS.Domain.Tasks;
using PLCS.Domain.Trays;
using PLCS.Domain.Users;

using Volo.Abp.Data;

namespace PLCS.EntityFrameworkCore.EntityFrameworkCore;

[ConnectionStringName("Default")]
public class PLCSDbContext : AbpDbContext<PLCSDbContext>
{
    public DbSet<User> Users { get; set; }
    public DbSet<Role> Roles { get; set; }
    public DbSet<Menu> Menus { get; set; }
    public DbSet<Order> Orders { get; set; }
    public DbSet<OrderRunningCondition> OrderRunningConditions { get; set; }
    public DbSet<HisOrder> HisOrders { get; set; }
    public DbSet<TaskModel> Tasks { get; set; }
    public DbSet<PathResult> PathResults { get; set; }
    public DbSet<InstructionTimeLog> InstructionTimeLogs { get; set; }
    public DbSet<HisTask> HisTasks { get; set; }
    public DbSet<Equipment> Equipments { get; set; }
    public DbSet<Station> Stations { get; set; }
    public DbSet<Tray> Trays { get; set; }
    public DbSet<Process> Processes { get; set; }
    public DbSet<Trigger> Triggers { get; set; }
    public DbSet<Solution> Solutions { get; set; }
    public DbSet<SolutionStep> SolutionSteps { get; set; }
    public DbSet<PLCConfig> PLCConfigs { get; set; }
    public DbSet<PLCReadData> PLCReadDatas { get; set; }
    public DbSet<Config> Configs { get; set; }
    public DbSet<BackData> BackDatas { get; set; }
    public DbSet<InterfaceLog> InterfaceLogs { get; set; }
    public DbSet<ErrorLog> ErrorLogs { get; set; }
    public DbSet<ErrorLibrary> ErrorLibraries { get; set; }
    public DbSet<Instruction> Instructions { get; set; }
    public DbSet<HisInstruction> HisInstructions { get; set; }
    public DbSet<OperationLog> OperationLogs { get; set; }

    public PLCSDbContext(DbContextOptions<PLCSDbContext> options)
         : base(options)
    {
    }

    protected override void OnModelCreating(ModelBuilder builder)
    {
        base.OnModelCreating(builder);
        // PLCS实体的配置
        builder.ConfigurePLCSManagement();
    }
}